#!/usr/bin/python
# -*- coding:utf-8 -*-

a =2
b = 1
a,b = b, a
print(a, b)

aa = 55
bb = 44
print("%d %d" %(aa, bb))
print("%s" %(aa*bb))

list1 = [11, 22, 33, 44, 55, 66, 77]
list1.append(8)
print(list1)
print(list1[0])
list1.pop()
print(list1)
print('-------------------------')
list1.pop(0)
print(list1)
print('------------------------- inset')
list1.insert(0, 10)
print(list1)

print('------------------------- -1')
print(list1[-1])
print(list1[-3])

list1[-1] = 88
print(list1)
print('------------------------- 1:2 ')
print(list1[0:2])
print('------------------------- -5:-2')
print(list1[-5:-1])

print('------------------------- 跳跃')
print(list1[0:6:2])

print('------------------------- range')
print(list(range(0, 10)))
print(list(range(0, 10)[0:10:2]))

a= 22
tuple1=(1, 2, 3, a)
tuple2 =tuple1;
print(type(tuple1))
print(type(tuple2))
#tuple1[0] = 10;
print(type(tuple1))
print(type(tuple2))

address=("huangbo", 22, "shanghai")
print(address)

print("------------------ 字典---------------------")
dict1 = {"aa":1, "bb":2, "cc":3}
print(dict1)
print(dict1["aa"])
print(dict1["bb"])
print(dict1["cc"])
print(dict1.get("aa"))
dict1["aa"] = "这是一个字符串"
print(dict1)


if "aa" in dict1 :
    print("存在aa")
else:
    print("不存在aa")

dict1.pop("aa")
print(dict1)
print(dict1.items())
print("-----------------------")
dict1.clear()
print(dict1.items())

print("-----------------------set--------------------")
set1=set([1, 2, 3, 4, 5, 7, 7, 5, 2, 1])
print(set1)
print(type(set1))
set1.add(10)
print(set1)
set1.remove(10)
print(set1)
print("-------------------set2")
set1.pop()
print(set1)

set2=set([1, 3, 5, 7])
set3=set([2, 4, 5 ,7])
set4 = set3 & set2
set5 = set3 | set2
print(set4)
print(set5)

print("-----------------------------bool----------------")
bool1 = True
print(type(bool1))
print(bool(""))
print(bool(" "))
print(bool("123"))
print(bool(0))
print(bool(1))
print("--------------------true false ops")
print(True and False)
print(True or False)

print("--------------------数值比较-----------------")
print(4>3 and 3>1)
print(4>3 & 3>1)
print(4>3 or 3<1)

print("------------------if 比较-----------------------")
age = 20
if age > 18:
    print("成年")
elif age > 6 :
    print("儿童")
else:
    print("青少年")

print("---------------------for循环----------------------------")
list2=[100, 101, 102, 103, 104, 105, 106]
for var in list2 :
    print(var, end=" ")
print()
for i in range(len(list2)):
    print(list2[i], end="\t")
print()

if bool([1, 2, 3]):
    print(True)
print("[]")


print(divmod(5,3))

print(sum([2,3,4]))
